package esercizi_fondamenti;

public class DFCHGCFG {
	
		public static void main (String[] args){
		int [][] m ={{3, 1, 4}, {-2, -1, -2}, {1, 1, -1}};
		if (m.length != m[0].length) System.out.println(0);
		else
		for (int i=0; i< m.length; i++)
		if (met(m,m[i][m.length-1-i],i, m.length-1-i)) System.out.println(+1);
		else System.out.println(-1);
		}
		public static boolean met(int[][] m, int x, int y, int z){
		int[] v= met2(m, z);
		for (int i=0; i<v.length;i++)
		if (x<m[y][i] || x > v[i]) return false;
		return true;
		}
		public static int[] met2(int[][] m, int x){
		int[] res = new int[m.length];
		for (int i=0; i<res.length;i++)
		res[i] = m[i][x];
		return res;
		}
		}
